import * as commentsApi from '@/api/comments'

export default {
  namespaced: true,
  state: {
    commentsList: [],
  },
  mutations: {
    GET_COMMENTS_LIST(state, newValue) {
      state.commentsList = newValue
    }
  },
  actions: {
    async updateCommentsList({ commit }, [type, source]) {
      const res = await commentsApi.getCommentsList([type, source]);
      commit('GET_COMMENTS_LIST', res)
    }
  }
}
